package com.lbd.gulimall.product.feign;

import com.lbd.common.to.SkuReductionTO;
import com.lbd.common.to.SpuBoundTO;
import com.lbd.common.utils.R;
import com.lbd.gulimall.coupon.entity.SpuBoundsEntity;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * @ProjectName: gulimall
 * @Package: com.lbd.gulimall.product.feign
 * @ClassName: CouponFeignService
 * @Author: linbd
 * @Description:
 * @Date: 2021/6/24 22:19
 */
@FeignClient("gulimall-coupon")
public interface CouponFeignService {
    /**
     * 远程调用流程：
     *  1. 调用方的@RequestBody将对象转为json
     *  2. 找到被调用方coupon微服务，并向/coupon/spubounds/save发请求。
     *     将第一步转换的json放在post请求体位置，携带发送
     *  3. 被调用方收到请求，@RequestBody将json转为对象SpuBoundsEntity
     *  总结：只要json数据模型是兼容的，双方服务无需使用类型一致的参数
     *
     * @return:
     * @author: linbd
     * @date: 2021/6/24 22:30
     */
    @PostMapping("/coupon/spubounds/save")
    public R save(@RequestBody SpuBoundTO spuBoundTO);

    @PostMapping("/coupon/skufullreduction/saveFullreduction")
    public R saveFullreduction(@RequestBody SkuReductionTO skuReductionTO);
}
